iPaaS文档库 iPaaS文档库
00 概述
01 产品安装指南
02 快速入门指南
03 Studio使用指南
04 iPaaS使用指南
05 高级配置指南
06 接口服务说明
07 升级&数据迁移指南
08 产品集成指南
09 FAQ
  • iPaaS Docker镜像说明
  • 1 ESB Server多架构镜像说明
  • 1.1 获取ESB Server镜像
  • 1.2 运行ESB Server容器
  • 1.3 ESB-Server的dockerfile
  • 2 APIGateway Server多架构镜像说明
  • 2.1 获取 APIGateway Server镜像
  • 2.2 运行APIGateway Server容器
  • 2.3 APIGateway Server的dockerfile
  • 3 iPaaS Portal Standalone多架构镜像说明
  • 3.1 获取 iPaaS Portal Standalone镜像
  • 3.2 运行iPaaS Portal Standalone容器
  • 3.3 iPaaS Portal Standalone的dockerfile
  • 4 iPaaS Portal Server多架构镜像说明
  • 4.1 获取 iPaaS Portal Server镜像
  • 4.2 运行iPaaS Portal Server容器
  • 4.3 iPaaS Portal Server的dockerfile

# iPaaS Docker镜像说明

iPaaS多架构镜像支持在x64和aarch64不同硬件架构上无缝运行同一镜像,默认镜像基于普元公司基础镜像RockyLinux:8.10-openjdk1.8,可自行修改Dockerfile更换其他基础镜像。当执行 docker pull image:tag 时,Docker会检测宿主机架构(如 linux/x64、linux/aarch64),并从Manifest List中自动选择匹配的镜像层拉取。

# 1 ESB Server多架构镜像说明

# 1.1 获取ESB Server镜像

docker pull 192.168.16.18/esb-pro/ipassesbserver:9.1.0

# 1.2 运行ESB Server容器

docker run -d   --name esbServer \
  -e DB_TYPE=mysql \
  -e DB_URL=jdbc:mysql://192.168.16.144:3306/esb910 \
  -e DB_USER=root \
  -e DB_PASSWD=primeton000000 \
  -e ES_HOST=192.168.16.48 \
  -e ES_PORT=9200 \
  -e ES_NAME=elastic \
  -e ES_PW=primeton000000 \
  -e ES_CER=/opt/server/http_ca.crt \
  -e NOTIFICATION_PATH=http://esbGovernor:9099/ \
  -e ESB_SERVER_ID=esbServer1 \
  -p 6200:6200 -p 10001:10001 -p 10002:10002 -p 10003:10003 -p 10004:10004 -p 10005:10005 192.168.16.18/esb-pro/ipassesbserver:9.1.0
  说明:NOTIFICATION_PATH 是ESB Server与iPaaS Portal的通信地址,默认为iPaaS Portal的地址。 
       ESB_SERVER_ID 是ESB Server 的服务器名称唯一标识,与iPaaS Portal中添加的服务器名称一致。

# 1.3 ESB-Server的dockerfile

FROM  192.168.16.18/primeton-pub/rockylinux:8.10-openjdk1.8
MAINTAINER www.primeton.com
ENV APP_NAME=esbserver APP_PORT=6200 NOTIFICATION_PATH= \
	EOS_SYS_KEY= EOS_PROFILE= \
    REDIS_HOST= REDIS_PORT= REDIS_USER= REDIS_PASSWORD= REDIS_CLUSTER_NODES= \
    REDIS_SENTINEL_MASTER= REDIS_SENTINEL_NODES= REDIS_SENTINEL_USER= REDIS_SENTINEL_PASSWORD= \
    NACOS_URL= NACOS_USER= NACOS_PASSWORD= \
    SW_URL= JAVA_OPTS= PATCH_URLS= LICENSE_URL=

WORKDIR /opt/server
ADD Primeton_iPaaS_9.1.0_ESB_Server.tar .
COPY ./http_ca.crt  /opt/server/
COPY ./mysql-connector-java-5.1.45.jar /opt/server/server/libs


RUN echo -e '\
if [[ "${JAVA_OPTS}" == "" ]] || [[ "${JAVA_OPTS}" != *"-XX:MaxRAMPercentage"* ]]; \n\
then \n\
    export JAVA_OPTS="${JAVA_OPTS}" \n\
fi \n\
if [[ "${PATCH_URLS}" != "" ]]; \n\
then \n\
    cd /opt/server/lib \n\
    IFS="," read -ra urls <<< "$PATCH_URLS" \n\
    for url in "${urls[@]}" \n\
    do \n\
        curl -O $url \n\
        filename=$(basename "$url") \n\
        if [[ "${filename}" == *".zip" ]]; \n\
        then \n\
            unzip ${filename} && rm -f ${filename} \n\
        fi \n\
    done \n\
fi \n\
if [[ "${LICENSE_URL}" != "" ]]; \n\
then \n\
    curl -o /opt/primetonlicense.xml $LICENSE_URL \n\
fi \n\
sed -i "s/port: 6200/port: ${APP_PORT}/" /opt/server/server/conf/application.yml \n\

if [[ "${ES_HOST}" != "" ]]; \n\
then \n\
    sed -i "s/- ip: 127.0.0.1/- ip: ${ES_HOST}/" /opt/server/server/conf/application.yml \n\
	sed -i "s/port: 9200/port: ${ES_PORT}/" /opt/server/server/conf/application.yml \n\
    sed -i "s/username: elastic/username: ${ES_NAME}/" /opt/server/server/conf/application.yml \n\
    sed -i "s/password: primeton000000/password: ${ES_PW}/" /opt/server/server/conf/application.yml \n\
	sed -i "s@certificate: \/usr\/local\/elasticsearch\/elasticsearch-8.1.2\/config\/certs\/http_ca.crt@certificate: ${ES_CER}@" /opt/server/server/conf/application.yml \n\
fi \n\
if [[ "${DB_TYPE}" != "" ]]; \n\
then \n\
    sed -i "s/username: root/username: ${DB_USER}/" /opt/server/server/conf/application.yml \n\
    sed -i "s/password: 123456/password: ${DB_PASSWD}/" /opt/server/server/conf/application.yml \n\
    sed -i "s@url: jdbc:mysql:\/\/127.0.0.1:3306\/esb@url: ${DB_URL}@" /opt/server/server/conf/application.yml \n\
fi \n\
if [[ "${NOTIFICATION_PATH}" != "" ]]; \n\
then \n\
    sed -i "s|address: http://localhost:8080/|address: ${NOTIFICATION_PATH}|" /opt/server/server/conf/application.yml \n\
fi \n\
if [[ "${ESB_SERVER_ID}" != "" ]]; \n\
then \n\
    sed -i "s/ESB_SERVER_ID=.*$/ESB_SERVER_ID= ${ESB_SERVER_ID}/" /opt/server/server/EOS/_srv/startup.conf \n\
fi \n\
/opt/server/startServer.sh run -opens \n\
' > /opt/start.sh

RUN chmod +x /opt/start.sh
RUN chmod +x /opt/server/server/bin/*.sh
RUN chmod +x /opt/server/*.sh

EXPOSE ${APP_PORT}
CMD /bin/bash -c "/opt/start.sh"

# 2 APIGateway Server多架构镜像说明

# 2.1 获取 APIGateway Server镜像

docker pull 192.168.16.18/esb-pro/ipassgatewayserver:9.1.0

# 2.2 运行APIGateway Server容器

docker run -d  --name ipassGateway \
  -e REDIS_HOST=192.168.16.140 \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=123456 \
  -e ES_HOST=192.168.16.48 \
  -e ES_PORT=9200 \
  -e ES_NAME=elastic \
  -e ES_PW=primeton000000 \
  -e ES_CER=/opt/server/http_ca.crt \
  -e NOTIFICATION_PATH=esbGovernor:9099 \
  -p 6201:6201  192.168.16.18/esb-pro/ipassgatewayserver:9.1.0  
  说明:NOTIFICATION_PATH 是APIGateway Server与iPaaS Portal的通信地址,默认为iPaaS Portal的IP地址和端口。

# 2.3 APIGateway Server的dockerfile

FROM 192.168.16.18/primeton-pub/rockylinux:8.10-openjdk1.8
MAINTAINER www.primeton.com
ENV APP_NAME=APIGATEWAY APP_PORT=6201 NOTIFICATION_PATH= \
	EOS_SYS_KEY= EOS_PROFILE= \
    REDIS_HOST= REDIS_PORT= REDIS_USER= REDIS_PASSWORD= REDIS_CLUSTER_NODES= \
    REDIS_SENTINEL_MASTER= REDIS_SENTINEL_NODES= REDIS_SENTINEL_USER= REDIS_SENTINEL_PASSWORD= \
    NACOS_URL= NACOS_USER= NACOS_PASSWORD= \
    SW_URL= JAVA_OPTS= PATCH_URLS= LICENSE_URL=

WORKDIR /opt/server
ADD Primeton_iPaaS_9.1.0_APIGateway_Server.tar .
COPY ./http_ca.crt  /opt/server/
RUN \
    sed -i "/spring.application.name=.*$/cspring.application.name=${APP_NAME}" config/application.properties 
	
RUN echo -e '\
if [[ "${JAVA_OPTS}" == "" ]] || [[ "${JAVA_OPTS}" != *"-XX:MaxRAMPercentage"* ]]; \n\
then \n\
    export JAVA_OPTS="${JAVA_OPTS}" \n\
fi \n\
if [[ "${PATCH_URLS}" != "" ]]; \n\
then \n\
    cd /opt/server/lib \n\
    IFS="," read -ra urls <<< "$PATCH_URLS" \n\
    for url in "${urls[@]}" \n\
    do \n\
        curl -O $url \n\
        filename=$(basename "$url") \n\
        if [[ "${filename}" == *".zip" ]]; \n\
        then \n\
            unzip ${filename} && rm -f ${filename} \n\
        fi \n\
    done \n\
fi \n\
if [[ "${LICENSE_URL}" != "" ]]; \n\
then \n\
    curl -o /opt/primetonlicense.xml $LICENSE_URL \n\
fi \n\
sed -i "/server.port=.*$/cserver.port=${APP_PORT}" /opt/server/config/application.properties \n\

if [[ "${ES_HOST}" != "" ]]; \n\
then \n\
    sed -i "/elasticsearch.hosts\[0\]\.ip=.*$/celasticsearch.hosts\[0\]\.ip=${ES_HOST}"     /opt/server/config/application.properties \n\
    sed -i "/elasticsearch.hosts\[0\]\.port=.*$/celasticsearch.hosts\[0\]\.port=${ES_PORT}" /opt/server/config/application.properties \n\
    sed -i "/elasticsearch.username=.*$/celasticsearch.username=${ES_NAME}" /opt/server/config/application.properties \n\
    sed -i "/elasticsearch.password=.*$/celasticsearch.password=${ES_PW}" /opt/server/config/application.properties \n\
	sed -i "/elasticsearch.certificate=.*$/celasticsearch.certificate=${ES_CER}" /opt/server/config/application.properties \n\
fi \n\

if [[ "${REDIS_HOST}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.host=.*$/cspring.redis.host=${REDIS_HOST}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/cspring.redis.port=${REDIS_PORT}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/cspring.redis.username=${REDIS_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=${REDIS_PASSWORD}" /opt/server/config/application.properties \n\
elif [[ "${REDIS_CLUSTER_NODES}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.cluster.nodes=.*$/cspring.redis.cluster.nodes=${REDIS_CLUSTER_NODES}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/cspring.redis.username=${REDIS_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=${REDIS_PASSWORD}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
elif [[ "${REDIS_SENTINEL_NODES}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.sentinel.master=.*$/cspring.redis.sentinel.master=${REDIS_SENTINEL_MASTER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.nodes=.*$/cspring.redis.sentinel.nodes=${REDIS_SENTINEL_NODES}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.username=.*$/cspring.redis.sentinel.username=${REDIS_SENTINEL_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.password=.*$/cspring.redis.sentinel.password=${REDIS_SENTINEL_PASSWORD}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/c#spring.redis.username=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/c#spring.redis.password=" /opt/server/config/application.properties \n\
else \n\
    sed -i "/spring.redis.timeout=.*$/c#spring.redis.timeout=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/c#spring.redis.username=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/c#spring.redis.password=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-active=.*$/c#spring.redis.lettuce.pool.max-active=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-idle=.*$/c#spring.redis.lettuce.pool.max-idle=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-wait=.*$/c#spring.redis.lettuce.pool.max-wait=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.min-idle=.*$/c#spring.redis.lettuce.pool.min-idle=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.shutdown-timeout=.*$/c#spring.redis.lettuce.shutdown-timeout=" /opt/server/config/application.properties \n\
fi \n\
if [[ "${NACOS_URL}" == "" ]]; \n\
then \n\
    sed -i "/spring.cloud.nacos.discovery.enabled=.*$/cspring.cloud.nacos.discovery.enabled=false" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.config.enabled=.*$/cspring.cloud.nacos.config.enabled=false" /opt/server/config/bootstrap.properties \n\
else \n\
    sed -i "/spring.cloud.nacos.discovery.enabled=.*$/cspring.cloud.nacos.discovery.enabled=true" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.discovery.server-addr=.*$/cspring.cloud.nacos.discovery.server-addr=${NACOS_URL}" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.config.enabled=.*$/cspring.cloud.nacos.config.enabled=true" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.config.server-addr=.*$/cspring.cloud.nacos.config.server-addr=${NACOS_URL}" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.username=.*$/cspring.cloud.nacos.username=${NACOS_USER}" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.password=.*$/cspring.cloud.nacos.password=${NACOS_PASSWORD}" /opt/server/config/bootstrap.properties \n\
fi \n\
if [[ "${NOTIFICATION_PATH}" != "" ]]; \n\
then \n\
     sed -i "/gateway.exception.notification.path=.*$/cgateway.exception.notification.path=${NOTIFICATION_PATH}"      /opt/server/config/application.properties \n\
fi \n\

/opt/server/bin/startup.sh \n\
' > /opt/start.sh

RUN chmod +x /opt/start.sh
RUN chmod +x /opt/server/*.sh
RUN chmod +x /opt/server/bin/*.sh
RUN chmod +x /opt/server/*.jar

EXPOSE ${APP_PORT}
CMD /bin/bash -c "/opt/start.sh"

# 3 iPaaS Portal Standalone多架构镜像说明

# 3.1 获取 iPaaS Portal Standalone镜像

docker pull 192.168.16.18/esb-pro/ipassportalstandalone:9.1.0

# 3.2 运行iPaaS Portal Standalone容器

docker run -d  --name esbGovernor \
 -e JAVA_OPTS="-DDB_TYPE=MySql -DDB_DRIVER=com.mysql.jdbc.Driver -DDB_URL=jdbc:mysql://192.168.16.144:3306/esb910?characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true -DDB_USER=root -DDB_PASSWD=primeton000000 " \
  -e REDIS_HOST=192.168.16.140 \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=123456 \
  -e ES_HOST=192.168.16.48 \
  -e ES_PORT=9200 \
  -e ES_NAME=elastic \
  -e ES_PW=primeton000000 \
  -e ES_CER=/opt/server/http_ca.crt \
  -p 9099:9099  192.168.16.18/esb-pro/ipassportalstandalone:9.1.0

# 3.3 iPaaS Portal Standalone的dockerfile

FROM 192.168.16.18/primeton-pub/rockylinux:8.10-openjdk1.8
MAINTAINER www.primeton.com
ENV APP_NAME=ESB APP_PORT=9099  \
	EOS_SYS_KEY= EOS_PROFILE= \
    REDIS_HOST= REDIS_PORT= REDIS_USER= REDIS_PASSWORD= REDIS_CLUSTER_NODES= \
    REDIS_SENTINEL_MASTER= REDIS_SENTINEL_NODES= REDIS_SENTINEL_USER= REDIS_SENTINEL_PASSWORD= \
    NACOS_URL= NACOS_USER= NACOS_PASSWORD= \
    SW_URL= JAVA_OPTS= PATCH_URLS= LICENSE_URL=

WORKDIR /opt/server
ADD Primeton_iPaaS_9.1.0_Portal_Standalone.tar .
COPY ./mysql-connector-java-5.1.45.jar /opt/server/lib/
COPY ./http_ca.crt  /opt/server/


RUN \
    sed -i "/^export EOS_DAP_MEM_OPTS=/d" bin/startup.sh ;\
    \
    sed -i "/spring.application.name=.*$/cspring.application.name=${APP_NAME}" config/application.properties ;\
    \
    sed -i "69,76s/<configValue key=\"Database-Type\">.*/<configValue key=\"Database-Type\">\${DB_TYPE}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-DriverClass\">.*/<configValue key=\"C3p0-DriverClass\">\${DB_DRIVER}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-Url\">.*/<configValue key=\"C3p0-Url\">\${DB_URL}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-UserName\">.*/<configValue key=\"C3p0-UserName\">\${DB_USER}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-Password\">.*/<configValue key=\"C3p0-Password\">\${DB_PASSWD}<\/configValue>/" config/${APP_NAME}/config/user-config.xml

RUN echo -e '\
if [[ "${JAVA_OPTS}" == "" ]] || [[ "${JAVA_OPTS}" != *"-XX:MaxRAMPercentage"* ]]; \n\
then \n\
    export JAVA_OPTS="${JAVA_OPTS}" \n\
fi \n\
if [[ "${PATCH_URLS}" != "" ]]; \n\
then \n\
    cd /opt/server/lib \n\
    IFS="," read -ra urls <<< "$PATCH_URLS" \n\
    for url in "${urls[@]}" \n\
    do \n\
        curl -O $url \n\
        filename=$(basename "$url") \n\
        if [[ "${filename}" == *".zip" ]]; \n\
        then \n\
            unzip ${filename} && rm -f ${filename} \n\
        fi \n\
    done \n\
fi \n\
if [[ "${LICENSE_URL}" != "" ]]; \n\
then \n\
    curl -o /opt/primetonlicense.xml $LICENSE_URL \n\
fi \n\
sed -i "/server.port=.*$/cserver.port=${APP_PORT}" /opt/server/config/application.properties \n\
if [[ "${EOS_SYS_KEY}" != "" ]]; \n\
then \n\
    sed -i "/eos.application.sys-key=.*$/ceos.application.sys-key=${EOS_SYS_KEY}" /opt/server/config/application.properties \n\
fi \n\
if [[ "${EOS_PROFILE}" != "" ]]; \n\
then \n\
    sed -i "/eos.profiles.active=.*$/ceos.profiles.active=${EOS_PROFILE}" /opt/server/config/application.properties \n\
fi \n\	

if [[ "${ES_HOST}" != "" ]]; \n\
then \n\
    sed -i "/elasticsearch.hosts\[0\]\.ip=.*$/celasticsearch.hosts\[0\]\.ip=${ES_HOST}"     /opt/server/config/application-esb.properties \n\
    sed -i "/elasticsearch.hosts\[0\]\.port=.*$/celasticsearch.hosts\[0\]\.port=${ES_PORT}" /opt/server/config/application-esb.properties \n\
    sed -i "/elasticsearch.username=.*$/celasticsearch.username=${ES_NAME}" /opt/server/config/application-esb.properties \n\
    sed -i "/elasticsearch.password=.*$/celasticsearch.password=${ES_PW}" /opt/server/config/application-esb.properties \n\
	sed -i "/elasticsearch.certificate=.*$/celasticsearch.certificate=${ES_CER}" /opt/server/config/application-esb.properties \n\
fi \n\
if [[ "${REDIS_HOST}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.host=.*$/cspring.redis.host=${REDIS_HOST}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/cspring.redis.port=${REDIS_PORT}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/cspring.redis.username=${REDIS_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=${REDIS_PASSWORD}" /opt/server/config/application.properties \n\
elif [[ "${REDIS_CLUSTER_NODES}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.cluster.nodes=.*$/cspring.redis.cluster.nodes=${REDIS_CLUSTER_NODES}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/cspring.redis.username=${REDIS_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=${REDIS_PASSWORD}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
elif [[ "${REDIS_SENTINEL_NODES}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.sentinel.master=.*$/cspring.redis.sentinel.master=${REDIS_SENTINEL_MASTER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.nodes=.*$/cspring.redis.sentinel.nodes=${REDIS_SENTINEL_NODES}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.username=.*$/cspring.redis.sentinel.username=${REDIS_SENTINEL_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.password=.*$/cspring.redis.sentinel.password=${REDIS_SENTINEL_PASSWORD}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/c#spring.redis.username=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/c#spring.redis.password=" /opt/server/config/application.properties \n\
else \n\
    sed -i "/spring.redis.timeout=.*$/c#spring.redis.timeout=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/c#spring.redis.username=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/c#spring.redis.password=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-active=.*$/c#spring.redis.lettuce.pool.max-active=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-idle=.*$/c#spring.redis.lettuce.pool.max-idle=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-wait=.*$/c#spring.redis.lettuce.pool.max-wait=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.min-idle=.*$/c#spring.redis.lettuce.pool.min-idle=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.shutdown-timeout=.*$/c#spring.redis.lettuce.shutdown-timeout=" /opt/server/config/application.properties \n\
fi \n\
if [[ "${NACOS_URL}" == "" ]]; \n\
then \n\
    sed -i "/spring.cloud.nacos.discovery.enabled=.*$/cspring.cloud.nacos.discovery.enabled=false" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.config.enabled=.*$/cspring.cloud.nacos.config.enabled=false" /opt/server/config/bootstrap.properties \n\
else \n\
    sed -i "/spring.cloud.nacos.discovery.enabled=.*$/cspring.cloud.nacos.discovery.enabled=true" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.discovery.server-addr=.*$/cspring.cloud.nacos.discovery.server-addr=${NACOS_URL}" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.config.enabled=.*$/cspring.cloud.nacos.config.enabled=true" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.config.server-addr=.*$/cspring.cloud.nacos.config.server-addr=${NACOS_URL}" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.username=.*$/cspring.cloud.nacos.username=${NACOS_USER}" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.password=.*$/cspring.cloud.nacos.password=${NACOS_PASSWORD}" /opt/server/config/bootstrap.properties \n\
fi \n\

/opt/server/startServer.sh run -opens \n\
' > /opt/start.sh

RUN chmod +x /opt/start.sh
RUN chmod +x /opt/server/bin/*.sh
RUN chmod +x /opt/server/*.sh
RUN chmod +x /opt/server/*.jar

EXPOSE ${APP_PORT}
CMD /bin/bash -c "/opt/start.sh"

# 4 iPaaS Portal Server多架构镜像说明

# 4.1 获取 iPaaS Portal Server镜像

docker pull 192.168.16.18/esb-pro/ipassportalserver:9.1.0

# 4.2 运行iPaaS Portal Server容器

docker run -d  --name ipass_miro \
  -e JAVA_OPTS="-DDB_TYPE=MySql -DDB_DRIVER=com.mysql.jdbc.Driver -DDB_URL=jdbc:mysql://192.168.16.144:3306/esb910?characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true -DDB_USER=root -DDB_PASSWD=primeton000000 " \
  -e AFC_NAME=192.168.2.150:28083 \
  -e REDIS_HOST=192.168.16.140 \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD=123456 \
  -e ES_HOST=192.168.16.48 \
  -e ES_PORT=9200 \
  -e ES_NAME=elastic \
  -e ES_PW=primeton000000 \
  -e ES_CER=/opt/server/http_ca.crt \
  -p 9098:9098  192.168.16.18/esb-pro/ipassportalserver:9.1.0  

# 4.3 iPaaS Portal Server的dockerfile

FROM 192.168.16.18/primeton-pub/rockylinux:8.10-openjdk1.8
MAINTAINER www.primeton.com
ENV APP_NAME=ESB APP_PORT=9098  \
	EOS_SYS_KEY= EOS_PROFILE= \
    REDIS_HOST= REDIS_PORT= REDIS_USER= REDIS_PASSWORD= REDIS_CLUSTER_NODES= \
    REDIS_SENTINEL_MASTER= REDIS_SENTINEL_NODES= REDIS_SENTINEL_USER= REDIS_SENTINEL_PASSWORD= \
    NACOS_URL= NACOS_USER= NACOS_PASSWORD= \
    SW_URL= JAVA_OPTS= PATCH_URLS= LICENSE_URL=

WORKDIR /opt/server
ADD Primeton_iPaaS_9.1.0_Portal_Server.tar .
COPY ./mysql-connector-java-5.1.45.jar /opt/server/lib/
COPY ./http_ca.crt  /opt/server/


RUN \
    sed -i "/^export EOS_DAP_MEM_OPTS=/d" bin/startup.sh ;\
    \
    sed -i "/spring.application.name=.*$/cspring.application.name=${APP_NAME}" config/application.properties ;\
    \
    sed -i "69,76s/<configValue key=\"Database-Type\">.*/<configValue key=\"Database-Type\">\${DB_TYPE}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-DriverClass\">.*/<configValue key=\"C3p0-DriverClass\">\${DB_DRIVER}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-Url\">.*/<configValue key=\"C3p0-Url\">\${DB_URL}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-UserName\">.*/<configValue key=\"C3p0-UserName\">\${DB_USER}<\/configValue>/" config/${APP_NAME}/config/user-config.xml ;\
    sed -i "69,76s/<configValue key=\"C3p0-Password\">.*/<configValue key=\"C3p0-Password\">\${DB_PASSWD}<\/configValue>/" config/${APP_NAME}/config/user-config.xml

RUN echo -e '\
if [[ "${JAVA_OPTS}" == "" ]] || [[ "${JAVA_OPTS}" != *"-XX:MaxRAMPercentage"* ]]; \n\
then \n\
    export JAVA_OPTS="${JAVA_OPTS}" \n\
fi \n\
if [[ "${PATCH_URLS}" != "" ]]; \n\
then \n\
    cd /opt/server/lib \n\
    IFS="," read -ra urls <<< "$PATCH_URLS" \n\
    for url in "${urls[@]}" \n\
    do \n\
        curl -O $url \n\
        filename=$(basename "$url") \n\
        if [[ "${filename}" == *".zip" ]]; \n\
        then \n\
            unzip ${filename} && rm -f ${filename} \n\
        fi \n\
    done \n\
fi \n\
if [[ "${LICENSE_URL}" != "" ]]; \n\
then \n\
    curl -o /opt/primetonlicense.xml $LICENSE_URL \n\
fi \n\
sed -i "/server.port=.*$/cserver.port=${APP_PORT}" /opt/server/config/application.properties \n\
if [[ "${EOS_SYS_KEY}" != "" ]]; \n\
then \n\
    sed -i "/eos.application.sys-key=.*$/ceos.application.sys-key=${EOS_SYS_KEY}" /opt/server/config/application.properties \n\
fi \n\
if [[ "${EOS_PROFILE}" != "" ]]; \n\
then \n\
    sed -i "/eos.profiles.active=.*$/ceos.profiles.active=${EOS_PROFILE}" /opt/server/config/application.properties \n\
fi \n\	

if [[ "${ES_HOST}" != "" ]]; \n\
then \n\
    sed -i "/elasticsearch.hosts\[0\]\.ip=.*$/celasticsearch.hosts\[0\]\.ip=${ES_HOST}"     /opt/server/config/application-esb.properties \n\
    sed -i "/elasticsearch.hosts\[0\]\.port=.*$/celasticsearch.hosts\[0\]\.port=${ES_PORT}" /opt/server/config/application-esb.properties \n\
    sed -i "/elasticsearch.username=.*$/celasticsearch.username=${ES_NAME}" /opt/server/config/application-esb.properties \n\
    sed -i "/elasticsearch.password=.*$/celasticsearch.password=${ES_PW}" /opt/server/config/application-esb.properties \n\
	sed -i "/elasticsearch.certificate=.*$/celasticsearch.certificate=${ES_CER}" /opt/server/config/application-esb.properties \n\
fi \n\
if [[ "${AFC_NAME}" != "" ]]; \n\
then \n\
    sed -i "/afc.application.name=.*$/cafc.application.name=${AFC_NAME}" /opt/server/config/application-afc.properties  \n\
fi \n\
if [[ "${REDIS_HOST}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.host=.*$/cspring.redis.host=${REDIS_HOST}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/cspring.redis.port=${REDIS_PORT}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/cspring.redis.username=${REDIS_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=${REDIS_PASSWORD}" /opt/server/config/application.properties \n\
elif [[ "${REDIS_CLUSTER_NODES}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.cluster.nodes=.*$/cspring.redis.cluster.nodes=${REDIS_CLUSTER_NODES}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/cspring.redis.username=${REDIS_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/cspring.redis.password=${REDIS_PASSWORD}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
elif [[ "${REDIS_SENTINEL_NODES}" != "" ]]; \n\
then \n\
    sed -i "/spring.redis.sentinel.master=.*$/cspring.redis.sentinel.master=${REDIS_SENTINEL_MASTER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.nodes=.*$/cspring.redis.sentinel.nodes=${REDIS_SENTINEL_NODES}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.username=.*$/cspring.redis.sentinel.username=${REDIS_SENTINEL_USER}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.sentinel.password=.*$/cspring.redis.sentinel.password=${REDIS_SENTINEL_PASSWORD}" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/c#spring.redis.username=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/c#spring.redis.password=" /opt/server/config/application.properties \n\
else \n\
    sed -i "/spring.redis.timeout=.*$/c#spring.redis.timeout=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.host=.*$/c#spring.redis.host=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.port=.*$/c#spring.redis.port=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.username=.*$/c#spring.redis.username=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.password=.*$/c#spring.redis.password=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-active=.*$/c#spring.redis.lettuce.pool.max-active=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-idle=.*$/c#spring.redis.lettuce.pool.max-idle=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.max-wait=.*$/c#spring.redis.lettuce.pool.max-wait=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.pool.min-idle=.*$/c#spring.redis.lettuce.pool.min-idle=" /opt/server/config/application.properties \n\
    sed -i "/spring.redis.lettuce.shutdown-timeout=.*$/c#spring.redis.lettuce.shutdown-timeout=" /opt/server/config/application.properties \n\
fi \n\
if [[ "${NACOS_URL}" == "" ]]; \n\
then \n\
    sed -i "/spring.cloud.nacos.discovery.enabled=.*$/cspring.cloud.nacos.discovery.enabled=false" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.config.enabled=.*$/cspring.cloud.nacos.config.enabled=false" /opt/server/config/bootstrap.properties \n\
else \n\
    sed -i "/spring.cloud.nacos.discovery.enabled=.*$/cspring.cloud.nacos.discovery.enabled=true" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.discovery.server-addr=.*$/cspring.cloud.nacos.discovery.server-addr=${NACOS_URL}" /opt/server/config/application-nacos.properties \n\
    sed -i "/spring.cloud.nacos.config.enabled=.*$/cspring.cloud.nacos.config.enabled=true" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.config.server-addr=.*$/cspring.cloud.nacos.config.server-addr=${NACOS_URL}" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.username=.*$/cspring.cloud.nacos.username=${NACOS_USER}" /opt/server/config/bootstrap.properties \n\
    sed -i "/spring.cloud.nacos.password=.*$/cspring.cloud.nacos.password=${NACOS_PASSWORD}" /opt/server/config/bootstrap.properties \n\
fi \n\


/opt/server/startServer.sh run -opens \n\
' > /opt/start.sh

RUN chmod +x /opt/start.sh
RUN chmod +x /opt/server/bin/*.sh
RUN chmod +x /opt/server/*.sh
RUN chmod +x /opt/server/*.jar

EXPOSE ${APP_PORT}
CMD /bin/bash -c "/opt/start.sh"

← 5.6 报文转换配置说明 5.8 iPaaS K8s部署说明 →